package cn.sh.yhk.mapper.basic;

import cn.sh.yhk.model.basic.SCommonSql;
import cn.sh.yhk.model.basic.SCommonSqlExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface SCommonSqlMapper {
    @SelectProvider(type = SCommonSqlSqlProvider.class, method = "countByExample")
    long countByExample(SCommonSqlExample example);

    @DeleteProvider(type = SCommonSqlSqlProvider.class, method = "deleteByExample")
    int deleteByExample(SCommonSqlExample example);

    @Insert({
            "insert into s_common_sql (id, sql_name, ",
            "sql_text, comment)",
            "values (#{id,jdbcType=INTEGER}, #{sqlName,jdbcType=VARCHAR}, ",
            "#{sqlText,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR})"
    })
    int insert(SCommonSql record);

    @InsertProvider(type = SCommonSqlSqlProvider.class, method = "insertSelective")
    int insertSelective(SCommonSql record);

    @SelectProvider(type = SCommonSqlSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER),
            @Result(column = "sql_name", property = "sqlName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "sql_text", property = "sqlText", jdbcType = JdbcType.VARCHAR),
            @Result(column = "comment", property = "comment", jdbcType = JdbcType.VARCHAR)
    })
    List<SCommonSql> selectByExample(SCommonSqlExample example);

    @UpdateProvider(type = SCommonSqlSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SCommonSql record, @Param("example") SCommonSqlExample example);

    @UpdateProvider(type = SCommonSqlSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") SCommonSql record, @Param("example") SCommonSqlExample example);
}